package com.lin.missyou.model;

import com.lin.missyou.util.MapAndJson;
import lombok.*;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Map;
import java.util.Objects;

/**
 *
 * 用户常规信息与用户登录信息分开 建立多张表
 * @author gcq
 * @Create 2021-10-31
 */
@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
@Entity
@Builder
@Where(clause = "delete_time is null")
public class User extends BaseEntity{

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    private String openid;
    private String nickname;
    /**
     * 微信
     */
    private Long unifyUid;
    private String email;
    private String password;
    private String mobile;
//    private String wxProfile;


//    @ManyToMany(fetch = FetchType.LAZY)
//    @JoinTable(name = "UserCoupon",
//            joinColumns = @JoinColumn(name = "userId"),
//            inverseJoinColumns = @JoinColumn(name = "couponId"))
//    private List<Coupon> couponList;

    @Convert(converter = MapAndJson.class)
    private Map<String, String> wxProfile;


//    @OneToMany
//    @JoinColumn(name = "userId")
//    private List<Order> orders = new ArrayList<>();
}